import baseRequest from '../utils/requset'

/**
 * 
 * @param {订单相关接口} data 
 * @returns 
 */
// 结算页面
export function getCartSettlementApi (data) {
    return baseRequest.baseRequest('api/miniProgram/settlement/detail', 'get', data)
}
// 同城配送运费
export function getOrderFreightApi (orderId) {
    return baseRequest.baseRequest(`api/order/freight/fee/${orderId}`, 'get')
}
// 修改优惠券/api/miniProgram/settlement/changeCouponAndGetResult 
export function changeCouponAndGetResultApi (data) {
    return baseRequest.baseRequest('api/miniProgram/settlement/changeCouponAndGetResult', 'post', JSON.stringify(data), 
    // 'application/json' // 明确指定Content-Type
    )
}

// 提交订单
export function creatOrderApi (data) {
    return baseRequest.baseRequest('api/order/create', 'post', JSON.stringify(data))
}
// 支付回调通知接口
export function paymentNotifyApi (data) {
    return baseRequest.baseRequest('api/order/payment/notify', 'post', JSON.stringify(data))
}
// /
export function createPrePaymentApi (data) {
    return baseRequest.baseRequest('api/order/payment/createPrePayment', 'post', JSON.stringify(data))
}

/**
 * 购物车列表
 */
// 购物车列表
export function getCartListApi (data) {
    return baseRequest.baseRequest('api/miniProgram/shoppingCart/list', 'get', data)
}

// 加入购物车
export function addToShoppingCartApi (data) {
    return baseRequest.baseRequest('api/miniProgram/shoppingCart/addToShoppingCart', 'post', JSON.stringify(data))
}

// 取消勾选购物车商品
export function cancelShoppingCartItemsApi (data) {
    return baseRequest.baseRequest('api/miniProgram/shoppingCart/checkedShoppingCart/0', 'post', JSON.stringify(data))
}
// 勾选商品
export function checkedShoppingCartItemsApi (data) {
    return baseRequest.baseRequest('api/miniProgram/shoppingCart/checkedShoppingCart/1', 'post', JSON.stringify(data))
}
// 删除购物车中某些商品
export function deleteShoppingCartItemsApi (data) {
    return baseRequest.baseRequest('api/miniProgram/shoppingCart/delete', 'delete', JSON.stringify(data))
}
// 修改购物车列表 商品数量
export function setCartSkuNumApi (data) {
    return baseRequest.baseRequest('api/miniProgram/shoppingCart/setCartSkuNum', 'post', JSON.stringify(data))
}

// 修改购物车商品的规格
// /api/miniProgram/shoppingCart/multiSpecAndNumModify  post请求
export function multiSpecAndNumModifyApi (data) {
    return baseRequest.baseRequest('api/miniProgram/shoppingCart/multiSpecAndNumModify', 'post', JSON.stringify(data))
}

// 商品详情页获取购物车数量
// /api/miniProgram/shoppingCart/size    get请求    购物的数字接口
export function getShoppingCartSizeApi () {
    return baseRequest.baseRequest('api/miniProgram/shoppingCart/size', 'get')
}

// 商户列表  自提点列表
export function getMerchantListApi (data) {
    return baseRequest.baseRequest('api/miniProgram/queryMerchantList', 'get', data)
}
// pageSize=10&pageNum=1
// 立即购买/api/miniProgram/settlement/detail/directBuy
export function directBuyApi (data) {
    return baseRequest.baseRequest('api/miniProgram/settlement/detail/directBuy', 'post', JSON.stringify(data))
}